// Created: 08/27/2025, ChangJiang Ru
public class ComparableCircle extends Circle implements CompareObject
{
    @Override
    public int compareTo(Object object)
    {
        if(this == object)
        {
            return 0;
        }
        if(object instanceof ComparableCircle)
        {
            ComparableCircle c = (ComparableCircle)object;
            // Error case!
//            return (int)(this.getRadius() - c.getRadius());
            // The correct case 1!
            /*
            if(this.getRadius() > c.getRadius())
                return 1;
            else if(this.getRadius() < c.getRadius())
                return -1;
            else
                return 0;
             */

            // The correct case 2!
            return Double.compare(this.getRadius(), c.getRadius());
        }
        else
        {
            throw new RuntimeException("Your input value not match!");
        }

    }

    public ComparableCircle()
    {

    }

    public ComparableCircle(double radius)
    {
        super(radius);
    }


}
